package com.example.znbk.znbklibrary.topbar;

import android.content.Context;
import android.text.Html;
import android.util.AttributeSet;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.example.znbk.znbklibrary.R;


public class Topbar extends RelativeLayout {

    public Topbar(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public void setTitle(String title) {
        TextView tvTitile = findViewById(R.id.tv_title);
        tvTitile.setVisibility(VISIBLE);
        tvTitile.setText(title);
    }

    public void showLeft(OnClickListener onClickListener, String text) {
        TextView tvLeft = findViewById(R.id.tv_left);
        tvLeft.setText(text);
        tvLeft.setVisibility(onClickListener == null ? GONE : VISIBLE);
        tvLeft.setOnClickListener(onClickListener);
    }

    public void showRight(OnClickListener onClickListener, String text) {
        TextView btnRight = findViewById(R.id.tv_right);
        btnRight.setText(text);
        btnRight.setVisibility(onClickListener == null ? GONE : VISIBLE);
        btnRight.setOnClickListener(onClickListener);
    }


}
